Skip to main content

All Questions

2votes
1answer
127views

function to group data by parent branches

I wrote this function to take database output like from PDO's fetchAll(PDO::FETCH_ASSOC) and turn it into a tree. For small datasets it works well. However, when ...
aswine's user avatar
4votes
3answers
1kviews

Filter an array, but remove the filtered elements

I needed a PHP function that would filter values from one array into a new one, while also removing those values from the original array. After looking through the docs, I didn't see any such function,...
Bee H.'s user avatar
1vote
1answer
2kviews

PHP Group associative Array duplicates and make subarrays of different values

I have this type of table: ...
aurepito's user avatar
1vote
2answers
102views

Check URL for keywords [closed]

I'm looking at improving my PHP knowledge and wondering if anybody has any tips on improving and optimising my function below? ...
stu's user avatar
  • 21
2votes
1answer
144views

Request mixed with JSON strings and array fields, in custom function for reduction need Simplify/Refactory

Client From a POST request I get a mixed structure of an array and JSON. To handle multiple type of elements I am using var_dump to get the passes. For ...
Minos Framework's user avatar
2votes
1answer
261views

Equity data processing: Fast and/or efficient file writing using PHP

Problem This project gets the past ~20 days of an equity data (such as $AAPL, $AMZN, $GOOG) plus the current equity "quote" (which comes every 60 seconds using a free API) and estimates seven "real-...
Emma's user avatar
  • 3,592
2votes
2answers
171views

Shuffle array elements by rearranging the key value associations

PHP's shuffle() function destroys the array keys, so I decided to write a shuffle function that doesn't do that and instead rearranges key-value associations. As I ...
Tobi Alafin's user avatar
3votes
5answers
2kviews

Sort multidimensional array based on another one containing the desired order

I have an array like this: ...
lampshade's user avatar
3votes
3answers
231views

Retrieve words from dictionary when they meet letter requirements

I have a set of functions that retrieve words from some arbitrary dictionary based on what letters they have. For example, this function gets words that use only the specified letters: ...
Andreas Hunter's user avatar
4votes
1answer
97views

Performing substitutions according to a word list in a database

A bit of history I had about 40,000 words in the database. I need words to correct the texts entered incorrectly by users. User enter text in any non-legal format and I use my words in the database ...
Andreas Hunter's user avatar
1vote
1answer
1kviews

PHP subset of 2 arrays containing objects - compared only by 1 attribute

I'm looking for a fast way to get the subset of 2 arrays containing the same kind of objects using PHP functions. I'm looking for the red part: ...
Maui's user avatar
0votes
1answer
87views

Detecting arrays with enough entries in common [closed]

I have made a function called testing. This function tests whether five numbers from each sub-array of $source are included in <...
GilesNorthcott's user avatar
2votes
3answers
56views

Summing durations associated with each MAC address in a MongoDB result

I have a script which get data from MongoDB in the form of array and show the result. The array has a number of records in the thousands. A sample array is as follows: ...
user122674's user avatar
1vote
1answer
125views

Create multi-dim array from cursor

I'm executing a cursor. I have cut off the code how the procedure is called and executed. This part is efficient. At last I have a small cursor. I'm calling the procedure, which returns this cursor ...
MaMu's user avatar
  • 235
2votes
1answer
258views

Populating an array from a database

I have a query that populates an array from the database. In some cases, this query returns a great amount of data, (let's say for purpose of an example, 100.000 records). Each row of the database has ...
MurifoX's user avatar

153050per page
close